﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <Style TargetType="ListView">
        <Setter Property="Background" Value="{DynamicResource GridViewBackground}" />
        <Setter Property="BorderBrush" Value="{DynamicResource GridViewColumnHeaderBorderBackground}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListView}">
                    <Border x:Name="Bd" CornerRadius="4" BorderThickness="{TemplateBinding BorderThickness}"
                            BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"
                            SnapsToDevicePixels="true" Padding="1">
                        <ScrollViewer Style="{DynamicResource {x:Static GridView.GridViewScrollViewerStyleKey}}"
                                Padding="{TemplateBinding Padding}">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Bd" Property="Background"
                                    Value="{DynamicResource GridViewDisabledBackground}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

    </Style>

    <Style x:Key="GridViewColumnHeaderGripper" TargetType="{x:Type Thumb}">
        <Setter Property="Canvas.Right" Value="-9" />
        <Setter Property="Width" Value="18" />
        <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ActualHeight}" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="Background" Value="{DynamicResource GridViewColumnHeaderBorderBackground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Padding="{TemplateBinding Padding}" Background="Transparent">
                        <Rectangle HorizontalAlignment="Center" Width="0" Fill="{TemplateBinding Background}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="GridViewColumnHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Background" Value="{DynamicResource GridViewColumnHeaderBackground}" />
        <Setter Property="BorderBrush" Value="{DynamicResource GridViewColumnHeaderBorderBackground}" />
        <Setter Property="Foreground" Value="{DynamicResource GridViewForeground}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="Margin" Value="1,2,1,1" />
        <Setter Property="FontFamily" Value="Tahoma" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                    <Grid SnapsToDevicePixels="true">
                        <Border Name="HeaderBorder" BorderThickness="1,1,1,1" CornerRadius="4"
                                BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition MaxHeight="7" />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Border Name="UpperHighlight" Visibility="Collapsed" Background="#AAAAAA"
                                        CornerRadius="4" />
                                <Border Grid.RowSpan="2" Padding="{TemplateBinding Padding}">
                                    <ContentPresenter Name="HeaderContent" Margin="0,0,0,1"
                                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                            RecognizesAccessKey="True"
                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                </Border>
                            </Grid>
                        </Border>
                        <Border Name="HeaderHoverBorder" BorderThickness="0" CornerRadius="4" />
                        <Border Name="HeaderPressBorder" BorderThickness="0" CornerRadius="4" />
                        <Canvas>
                            <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource GridViewColumnHeaderGripper}" />
                        </Canvas>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="HeaderBorder" Property="Background"
                                    Value="{DynamicResource GridViewColumnHeaderHoverBackground}" />
                            <Setter TargetName="HeaderHoverBorder" Property="BorderBrush" Value="#595959" />
                            <Setter TargetName="UpperHighlight" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_HeaderGripper" Property="Background" Value="Transparent" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="HeaderBorder" Property="Background"
                                    Value="{DynamicResource GridViewColumnHeaderPressBackground}" />
                            <Setter TargetName="HeaderHoverBorder" Property="BorderBrush" Value="#C3C3C3" />
                            <Setter TargetName="HeaderPressBorder" Property="BorderBrush" Value="#C3C3C3" />
                            <Setter TargetName="UpperHighlight" Property="Visibility" Value="Visible" />
                            <Setter TargetName="UpperHighlight" Property="Background" Value="#C3C3C3" />
                            <Setter TargetName="PART_HeaderGripper" Property="Visibility" Value="Hidden" />
                            <Setter TargetName="HeaderContent" Property="Margin" Value="1,1,0,0" />
                        </Trigger>
                        <Trigger Property="Height" Value="Auto">
                            <Setter Property="MinHeight" Value="20" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Role" Value="Floating">
                <Setter Property="Opacity" Value="0.4082" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                            <Canvas Name="PART_FloatingHeaderCanvas">
                                <Rectangle Opacity="0.4697" Fill="#FF000000" Width="{TemplateBinding ActualWidth}"
                                        Height="{TemplateBinding ActualHeight}" />
                            </Canvas>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="Role" Value="Padding">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                            <Border Name="HeaderBorder" BorderThickness="1,1,1,1" CornerRadius="4"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    Background="{TemplateBinding Background}" />
                            <ControlTemplate.Triggers>
                                <Trigger Property="Height" Value="Auto">
                                    <Setter Property="MinHeight" Value="20" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--LIST VIEW ITEM-->
    <Style x:Key="ListViewItemFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle StrokeThickness="1" RadiusX="2" RadiusY="2" Stroke="#8E6EA6F5" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <SolidColorBrush Color="#AAAAAA" x:Key="ListItemHoverFill" />
    <SolidColorBrush Color="#D4D4D4" x:Key="ListItemSelectedFill" />
    <SolidColorBrush Color="#333333" x:Key="ListItemSelectedHoverFill" />
    <SolidColorBrush Color="#333333" x:Key="ListItemSelectedInactiveFill" />

    <Style TargetType="{x:Type ListViewItem}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource ListViewItemFocusVisual}" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Foreground" Value="{DynamicResource GridViewForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListViewItem}">
                    <Border BorderThickness="1" CornerRadius="2" SnapsToDevicePixels="true" Background="Transparent">
                        <Border Name="InnerBorder" CornerRadius="1" BorderThickness="1">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition MaxHeight="11" />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Rectangle Name="UpperHighlight" Visibility="Collapsed" Fill="#75FFFFFF" />
                                <GridViewRowPresenter Grid.RowSpan="2"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="UpperHighlight" Property="Visibility" Value="Visible" />
                            <Setter TargetName="InnerBorder" Property="BorderBrush" Value="#80FFFFFF" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter TargetName="InnerBorder" Property="BorderBrush" Value="#80FFFFFF" />
                            <Setter TargetName="UpperHighlight" Property="Visibility" Value="Visible" />
                            <Setter TargetName="UpperHighlight" Property="Fill" Value="#40FFFFFF" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>